import {
    createRouter,
    createWebHistory
} from 'vue-router'


const routes = [{
        path: '/login',
        name: 'login',
        meta: {
            title: '登录'
        },
        component: () => import('../views/Login')
    },
    {
        path: '/',
        name: '',
        meta: {
            title: '总控'
        },
        component: () => import("../views/publicUser"),
        children: [
            {
                path: '/',
                name: 'home',
                meta: {
                    title: '首页'
                },
                component: () => import('../views/home')
            },
            {
                path: '/user/information',
                name: 'userInformation',
                meta: {
                    title: '个人用户信息'
                },
                component: () => import('../views/publicUser/publicUserInformation')
            },
            {
                path: '/user/softwareCopyright',
                name: 'userSoftwareCopyright',
                meta: {
                    title: '个人软件著作权'
                },
                component: () => import('../views/publicUser/publicSoftwareCopyright')
            },
            {
                path: '/user/meeting',
                name: 'userMeeting',
                meta: {
                    title: '个人参加会议'
                },
                component: () => import('../views/publicUser/publicMeeting')
            },
            {
                path: '/user/publications',
                name: 'userPublications',
                meta: {
                    title: '个人出版刊物'
                },
                component: () => import('../views/publicUser/publicPublications')
            },
            {
                path: '/user/patent',
                name: 'userPatent',
                meta: {
                    title: '个人专利'
                },
                component: () => import('../views/publicUser/publicPatent')
            },
            {
                path: '/user/teachingReward',
                name: 'userTeachingReward',
                meta: {
                    title: '个人教育成果'
                },
                component: () => import('../views/publicUser/publicTeachingReward')
            },
            {
                path: '/user/researchAchievements',
                name: 'userResearchAchievements',
                meta: {
                    title: '个人科研成果'
                },
                component: () => import('../views/publicUser/publicResearchAchievements')
            },
            {
                path: '/user/disciplineCompetition',
                name: 'userDisciplineCompetition',
                meta: {
                    title: '个人学科竞赛'
                },
                component: () => import('../views/publicUser/publicDisciplineCompetition')
            },
            {
                path: '/user/zproject',
                name: 'userZproject',
                meta: {
                    title: '个人纵向项目'
                },
                component: () => import('../views/publicUser/publicZproject')
            },
            {
                path: '/user/hproject',
                name: 'userHproject',
                meta: {
                    title: '个人横向项目'
                },
                component: () => import('../views/publicUser/publicHproject')
            },
            {
                path: '/user/paper',
                name: 'userPaper',
                meta: {
                    title: '个人学术论文'
                },
                component: () => import('../views/publicUser/publicPaper')
            },
            {
                path: '/user/achievementTransformation',
                name: 'userAchievementTransformation',
                meta: {
                    title: '个人成果转化'
                },
                component: () => import('../views/publicUser/publicAchievementTransformation')
            },
            {
                path: '/admin/information',
                name: 'adminInformation',
                meta: {
                    title: '所有成员用户信息'
                },
                component: () => import('../views/admin/adminInformation')
            },
            {
                path: '/admin/paper',
                name: 'adminPaper',
                meta: {
                    title: '所有学术论文'
                },
                component: () => import('../views/admin/adminPaper')
            },
            {
                path: '/admin/achievementTransformation',
                name: 'adminAchievementTransformation',
                meta: {
                    title: '所有成果转化'
                },
                component: () => import('../views/admin/adminAchievementTransformation')
            },
            {
                path: '/admin/disciplineCompetition',
                name: 'adminDisciplineCompetition',
                meta: {
                    title: '所有学科竞赛'
                },
                component: () => import('../views/admin/adminDisciplineCompetition')
            },
            {
                path: '/admin/hproject',
                name: 'adminHproject',
                meta: {
                    title: '所有横向项目'
                },
                component: () => import('../views/admin/adminHproject')
            },
            {
                path: '/admin/patent',
                name: 'adminPatent',
                meta: {
                    title: '所有专利'
                },
                component: () => import('../views/admin/adminPatent')
            },
            {
                path: '/admin/publications',
                name: 'adminPublications',
                meta: {
                    title: '所有出版刊物'
                },
                component: () => import('../views/admin/adminPublications')
            },
            {
                path: '/admin/researchAchievements',
                name: 'adminResearchAchievements',
                meta: {
                    title: '所有科研成果'
                },
                component: () => import('../views/admin/adminResearchAchievements')
            },
            {
                path: '/admin/softwareCopyright',
                name: 'adminSoftwareCopyright',
                meta: {
                    title: '所有软件著作权'
                },
                component: () => import('../views/admin/adminSoftwareCopyright')
            },
            {
                path: '/admin/teachingReward',
                name: 'adminTeachingReward',
                meta: {
                    title: '所有教育成果'
                },
                component: () => import('../views/admin/adminTeachingReward')
            },
            {
                path: '/admin/zproject',
                name: 'adminZproject',
                meta: {
                    title: '所有纵向项目'
                },
                component: () => import('../views/admin/adminZproject')
            },
            {
                path: '/admin/meeting',
                name: 'adminMeeting',
                meta: {
                    title: '所有参加会议'
                },
                component: () => import('../views/admin/adminMeeting')
            },
        ]
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

router.beforeEach((to, from, next) => {

document.title = to.meta.title

next()

})

export default router
